if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PreservationNoticeHistoryGetByIdentifier]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].PreservationNoticeHistoryGetByIdentifier
GO

CREATE PROCEDURE dbo.PreservationNoticeHistoryGetByIdentifier
(
	@Identifier varchar(500)
)
AS
SET NOCOUNT ON

SELECT
	PreservationNoticeHistoryID,
	SiteID,
	PreservationNoticeID,
	EventType,
	PreservationNoticeName,
	DateEmailMessageCreated,
	DateEmailMessageSent,
	DateAcknowledged,
	FromAddress,
	MessageSubject, 
	MessageBody,
	Identifier,
	InterviewDate,
	CustodianID,
	CustodianLastName,
	CustodianFirstName,
	HasAttachments,
	CustodianEmail,
	VerificationTries
FROM 
	PreservationNoticeHistory
WHERE
	Identifier = @Identifier
ORDER BY 
	PreservationNoticeHistoryID DESC
GO